package exercise2;

import java.util.Scanner;

public class NumberPlus extends BaseExample {
//	整数位数和
	public void sum() {
		this.logger.debug("请输入一个整数(0-999):");
		@SuppressWarnings("resource")
		Scanner s = new Scanner(System.in);
		String n = s.next();

		int intValue = Integer.parseInt(n);
		int sum = 0;
		int a = intValue / 100;
		int b = (intValue / 10) % 10;
		int c = intValue % 10;
		sum = a + b + c;
		this.logger.debug("该整数的各位数之和为：" + sum);
	}
}
